<template>
  <div class="page">
    <div class="page" v-if="storeExhibitInfo&&storeExhibitInfo.store_goods">
    <div class="oneBox display">
      <div class="logo">
        <div class="logoImg">
           <img :src="imgActive" alt="" />
        </div>
        <div class="imgs">
          <div v-for="(item,index) in storeExhibitInfo.store_goods.goods_imgs" :key="index" @click="()=>{imgActive = item}">
            <img :src="item" alt="">
          </div>
        </div>
      </div>
      <div class="info">
        <p class="title Name">{{ storeExhibitInfo.store_goods.goods_name }}</p>
        <el-divider></el-divider>
        <p class="title "><span>分类:</span>{{ storeExhibitInfo.store_goods.tags_name }}</p>
        <p class="title "><span >规格:</span>{{ storeExhibitInfo.store_goods.store_one.company_name }}</p>
        <p class="title"><span>公司:</span>{{ storeExhibitInfo.store_goods.tags_name }}</p>
        <p class="title"><span>展位号:</span>{{ storeExhibitInfo.store_exhibit.booth_no }}</p>
        <p class="title">{{ storeExhibitInfo.store_goods.goods_dec }}</p>
      </div>
    </div>
    <div class="oneBox branding">
      <div class="title" style="margin-top:0;"> 
        <div class="english">OTHER EXHIBIT</div>
        <div class="chinese">其他同类展品</div>
      </div>
      <div class="productList">
        <div class="product" v-for="item in storeExhibitInfo.goods" :key="item.id" @click="handleClick(item)">
          <div class="img">
            <img :src="item.goods_img" alt="">
          </div>
          <div class="productInfo">
            <p class="name">{{ item.goods_name }}</p>
            <p class="class">所属分类：{{ item.tags_name }}</p>
            <p class="desc">{{ item.goods_name }}</p>
          </div>
        </div>
      </div>
    </div>
  </div>
  </div>
</template>

<script>
import { getStoreGoodsInfo,getExhibits } from '@/api/index'
export default {
 data() {
    return {
      formInline: {
        code: 'fb',
        goods_id: '',
      },
      imgActive: '',
      storeExhibitInfo: {},
    }
  },
   created(){
    this.formInline.goods_id = this.$route.query.id
    getStoreGoodsInfo(this.formInline).then(res => {
      this.storeExhibitInfo = res.data
      this.storeExhibitInfo.store_goods.goods_imgs =JSON.parse(this.storeExhibitInfo.store_goods.goods_imgs)
      this.imgActive = this.storeExhibitInfo.store_goods.goods_img
      this.storeExhibitInfo.store_goods.goods_imgs.unshift(this.storeExhibitInfo.store_goods.goods_img)
      if(this.storeExhibitInfo.store_goods.goods_imgs.length > 4){
        this.storeExhibitInfo.store_goods.goods_imgs.length = 4
      }
    })
  },
  methods:{
    handleClick(item){
      this.$router.push({
        path: '/journal/productInfo',
        query: {
          id: item.id,
        }
      })
    }
  }
}
</script>

<style scoped lang="scss">
.oneBox{
  .logo{
    display: flex;
    
    .logoImg{
      width:26.875rem;
      height: 26.875rem;
      box-shadow: 0px 0px 0.25rem 0px rgba(0, 0, 0, 0.1);
      img{
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
    }
   .imgs{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    margin:0 2rem 0;   
     div{
      width: 5rem;
      height: 5rem;
      box-shadow: 0px 0px 0.25rem 0px rgba(0, 0, 0, 0.1);
      img{
        width: 100%;
        height: 100%;
        object-fit: cover;
        cursor: pointer;
      }
    }
  }}
  .info{
    
    font-size: .875rem;
    display: flex;
    flex-direction: column;
    .title{
      flex: 1;
      display: flex;
      align-items: center;
      margin:0 0 0.75rem;
      line-height: 1.5rem;
      text-align: left;
      color: #333;
        span{
          color: #6D7278;
          margin-right: .5rem;
        }
    }
    .Name{
      font-size: 1.75rem;
      font-weight: 500;
      line-height: 1.75rem;
    }
  }
  .left{
    line-height: 1.5rem;
  }
  .left , .right{
    flex: 1;
  }
  .right{
    width: 39.5625rem;
    height: 29.625rem;
    margin-left: 3.75rem;
    img{
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
  .productList{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 2.25rem 1.25rem;
    .product{
      display: flex;
      cursor: pointer;
      background: #FFF;
      .img{
        width:12.5rem;
        height:12.5rem;
        img{
          width: 100%;
          height: 100%;
          object-fit: cover;
        }
      }
      .productInfo{
        width:69%;
        padding:0 1.125rem;
        box-sizing: border-box;
        p{
          margin: 0;
        }
        .name{
          font-size: 1.25rem;
          font-weight: 500;
          line-height: 1.75rem;
          color: #333;
          margin:1.625rem 0 0 0;
        }
        .class{
          font-size: 1rem;
          font-weight: 400;
          line-height: 1.5rem;
          color: #333;
          margin: .75rem 0 0 0;
        }
        .desc{
          font-size: 1rem;
          font-weight: 400;
          line-height: 1.5rem;
          color: #333;
          margin: 0.5rem 0 0 0;
        }
      }
    }
  }
}
</style>